home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 16 / AMIGAplus Sonderheft 16 (1998)(ICP)(DE)[!].iso / pd / anwendungen / amicad / arexx_english / cartouche.amicad < prev    next >
Text File  |  1998-08-09  |  3KB  |  143 lines

  1. /* This ARexx script creates a cartouche in the current AmiCAD window */
  2. /* Version 1.05e, 9 août 1998 © R.Florac */
  3.  
  4. options results
  5.  
  6. organisation="ORGANISATION NAME"
  7. signal on error
  8. signal on syntax
  9.  
  10. IF (~show('L','rexxlocaldates.library')) THEN
  11.   call addlib('rexxlocaldates.library',0,-30,0)
  12.  
  13. if (show('L','rexxlocaldates.library')) then do
  14.     Ib = OpenLocale()
  15.     jour = FormatDate(Ib, ,"%A %e %B %Y")
  16. end
  17. else do
  18.     'DATE(1)'; jour=result
  19. end
  20.  
  21. 'WWIDTH(-1)'; l = result; lc = result % 3
  22. 'WHEIGHT(-1)'; h =result
  23. 'ROTATE(0,0):SYMMETRY(0,0)'
  24.  
  25. 'SELECT("Cartouche place"+CHR(10)+"Top left"+CHR(10)+"Top right"+CHR(10)+"Top center"+CHR(10)+"Bottom center"+CHR(10)+"Bottom right"+CHR(10)+"Bottom left")'
  26. c = result
  27.  
  28. 'ASK("Title of the cartouche")'; titre = result
  29. if titre='' then exit
  30.  
  31. if lc<260 then lc=260
  32. 'TXWIDTH("'organisation'")'; lt = result
  33. if lt>lc-10 then lc=lt+10
  34. 'TXWIDTH("'titre'")'; lt = result
  35. if lt>lc-10 then lc=lt+10
  36. dx=(lc+5)%4*3
  37. 'TXWIDTH("'jour'")'; lt = result
  38. if lt>dx-10 then do
  39.     dx=lt+10
  40.     lc=dx%3*4
  41. end
  42.  
  43. select
  44.     when c = 1 then do
  45.     x0 = 5
  46.     x1 = lc + 5
  47.     y0 = 5
  48.     y1 = 85
  49.     bh = 0
  50.     bb = 1
  51.     bg = 0
  52.     bd = 1
  53.     end
  54.     when c = 2 then do
  55.     x0 = l - lc - 5
  56.     x1 = l - 5
  57.     y0 = 5
  58.     y1 = 85
  59.     bh = 0
  60.     bb = 1
  61.     bg = 1
  62.     bd = 0
  63.     end
  64.     when c = 3 then do
  65.     x0 = l % 2 - lc % 2
  66.     x1 = x0 + lc
  67.     y0 = 5
  68.     y1 = 85
  69.     bh = 0
  70.     bb = 1
  71.     bg = 1
  72.     bd = 1
  73.     end
  74.     when c = 4 then do
  75.     x0 = l % 2 - lc % 2
  76.     x1 = x0 + lc
  77.     y0 = h - 85
  78.     y1 = h - 5
  79.     bh = 1
  80.     bb = 0
  81.     bg = 1
  82.     bd = 1
  83.     end
  84.     when c = 6 then do
  85.     x0 = 5
  86.     x1 = 5 + lc
  87.     y0 = h - 85
  88.     y1 = h - 5
  89.     bh = 1
  90.     bb = 0
  91.     bg = 0
  92.     bd = 1
  93.     end
  94.     when c = 5 then do
  95.     x0 = l - lc - 5
  96.     x1 = l - 5
  97.     y0 = h - 85
  98.     y1 = h - 5
  99.     bh = 1
  100.     bb = 0
  101.     bg = 1
  102.     bd = 0
  103.     end
  104.     otherwise exit
  105. end
  106.  
  107. 'DRAWMODE(-2):DRAW(5,5,'l-5',5):DRAW('l-5',5,'l-5','h-5')'
  108. 'DRAW('l-5','h-5',5,'h-5'):DRAW(5,'h-5',5,5)'
  109.  
  110. if bh > 0 then 'DRAW('x0','y0','x1','y0')'
  111. if bb > 0 then 'DRAW('x0','y1','x1','y1')'
  112. if bg > 0 then 'DRAW('x0','y0','x0','y1')'
  113. if bd > 0 then 'DRAW('x1','y0','x1','y1')'
  114. 'DRAW('x0','y0+20','x1','y0+20')'
  115. 'DRAWMODE(-1):DRAW('x0','y0+40','x1','y0+40'):DRAW('x0','y0+60','x1','y0+60')'
  116. 'DRAW('dx+x0','y0+40','dx+x0','y1')'
  117.  
  118. 'SETSCALE(0,1,1)'
  119. call centrer_texte(organisation,x0,x1,y0+15)
  120. call centrer_texte(titre,x0,x1,y0+35)
  121. call centrer_texte(jour,x0,x0+dx,y0+75)
  122. call centrer_texte("Document Number 1/1",x0,x0+dx,y0+55)
  123. call centrer_texte("REV 1",x0+dx,x1,y0+55)
  124. call centrer_texte("AmiCAD",x0+dx,x1,y0+75)
  125.  
  126. exit
  127.  
  128. centrer_texte: procedure
  129.     parse arg texte, xg, xd, y
  130.     'TXWIDTH("'texte'")'; l = result
  131.     l = (xd-xg-l)%2
  132.     'WRITE("'texte'",'xg+l','y')'
  133.     return
  134.  
  135. syntax:
  136. erreur=RC
  137. 'MESSAGE("Script Cartouche.AmiCAD:"+CHR(10)+"Syntax error"+CHR(10)+"in line 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
  138. exit
  139.  
  140. error:
  141. 'MESSAGE("Script Cartouche.AmiCAD:"+CHR(10)+"Error in line 'SIGL'")'
  142. exit
  143.